package com.example.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.example.domain.entity.Plant;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zrr
 * @since 2022-12-01
 */
@Mapper
public interface PlantMapper extends BaseMapper<Plant> {
    @Select("select * from plant where del_flag=0 order by like_count desc limit 5")
    public List<Plant> getHotPlantList();

    @Select("select distinct * from plant ${ew.customSqlSegment}")
    public IPage<Plant> getPlantPage(IPage<Plant> page, @Param(Constants.WRAPPER) QueryWrapper<Plant> qw);

}
